package com.itheima.objs;

import com.itheima.obj.Student;

import java.util.Objects;

public class Test {

    public static void main(String[] args) {
        Student student = new Student("00001","鹿老师",28);
        System.out.println(student);
        System.out.println(student.toString());

        //Objects.toString
        Student s=null;
        System.out.println(Objects.toString(s,"这是一个而空对象"));
        //isNull()

        if(Objects.isNull(s)){//s==null
            System.out.println("s是一个空对象");
        }
        //if(student!=null&&student.getAge()==28){//s!=null
        if(Objects.nonNull(student)&&student.getAge()==28){
            System.out.println("鹿老师是28岁的练习生");
        }
    }
}
